package com.easyliving.app;

import android.os.Bundle;
import android.util.Log;

import com.easyliving.app.lib.net.RemoteLoader;
import com.easyliving.app.lib.utils.Logger;
import com.easyliving.app.service.ICommonService;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.easyliving.app.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        BottomNavigationView navView = findViewById(R.id.nav_view);
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
        AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
                R.id.navigation_dashboard, R.id.navigation_home, R.id.navigation_notifications)
                .build();
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
        NavigationUI.setupWithNavController(binding.navView, navController);
        RemoteLoader.init("http://192.168.0.158:20000");
        Logger.setup(Log.DEBUG, "MyTag");
        Logger logger = Logger.getLogger();
        logger.d("this is logs: %s,%d", "hello", 8);
        //超长log
        logger.x("bla bla...");

        StringBuilder sBuilder = new StringBuilder();
        for (int i = 0; i < 5000; i++) {
            sBuilder.append("s");
            if (i == 4095) {
                Log.d("test",i+"");
                Log.d("test", sBuilder.toString()+i);
                logger.x("bla bla..." + sBuilder.toString()+"-"+i);
            }
        }


    }

}